﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;



namespace publico
{
    public static class PUB_CALCULA_VALORES
    {
         

        /// <summary>
        /// Calculo Total do Item
        /// </summary>
        /// <param name="qtd"></param>
        /// <param name="vlr_unit"></param>
        /// <param name="vlr_desconto"></param>
        /// <param name="vlr_outro"></param>
        /// <returns></returns>
        public static Decimal CalculoTotalItem(decimal qtd, decimal val_unitario, decimal val_desconto, decimal val_seguro, decimal val_outro, decimal val_frete)
        {
            Decimal resultado = 0;
            resultado = (qtd * val_unitario) - val_desconto + val_seguro + val_outro + val_frete;
            return resultado;


        }

        /// <summary>
        /// Retorna Valor IPI
        /// </summary>
        /// <param name="qtd"></param>
        /// <param name="val_unitario"></param>
        /// <param name="val_desconto"></param>
        /// <param name="val_seguro"></param>
        /// <param name="val_outro"></param>
        /// <param name="val_frete"></param>
        /// <param name="val_aliq_ipi"></param>
        /// <returns></returns>
        public static Decimal CalculoIPI(decimal qtd, decimal val_unitario, decimal val_desconto, decimal val_seguro, decimal val_outro, decimal val_frete, decimal val_aliq_ipi)
        {
            decimal val_bc_ipi = 0;
            decimal val_ipi = 0;
            // base calculo ipi 
            val_bc_ipi = (val_unitario * qtd) + val_seguro + val_outro + val_frete;
            val_ipi = (val_bc_ipi * val_aliq_ipi / 100);

            return val_ipi;
        }
 

        /// <summary>
        /// Retorna Valor ICMS
        /// </summary>
        /// <param name="val_bc_icms"></param>
        /// <param name="val_aliq_icms"></param>
        /// <returns></returns>
        public static decimal CalculoICMS00(decimal val_bc_icms , decimal val_aliq_icms)
        {
            decimal val_icms = 0;
            val_icms = (val_bc_icms * val_aliq_icms / 100);
            return val_icms;
        
        }


        /// <summary>
        /// Retorna Base Calculo ICMS
        /// </summary>
        /// <param name="qtd"></param>
        /// <param name="val_unitario"></param>
        /// <param name="val_desconto"></param>
        /// <param name="val_seguro"></param>
        /// <param name="val_outro"></param>
        /// <param name="val_frete"></param>
        /// <param name="val_ipi"></param>
        /// <param name="val_aliq_icms"></param>
        /// <returns></returns>
        public static decimal BaseCalculoICMS(decimal qtd, decimal val_unitario, decimal val_desconto, decimal val_seguro, decimal val_outro, decimal val_frete, decimal val_ipi, decimal val_aliq_icms)
        {
            decimal val_bc_icms = 0;
            val_bc_icms = (val_unitario * qtd) + val_seguro + val_frete + val_outro + val_ipi - val_desconto;
            return val_aliq_icms;

        }


        /// <summary>
        /// Retorna Valor ICMS ST
        /// </summary>
        /// <param name="val_bc_icms_st"></param>
        /// <param name="val_aliq_icms_destino"></param>
        /// <param name="val_icms_proprio"></param>
        /// <returns></returns>
        public static decimal CalculoICMS10(decimal val_bc_icms_st, decimal val_aliq_icms_destino, decimal val_icms_proprio)
        {
            decimal val_icms_st = 0;
            val_icms_st = (val_bc_icms_st * val_aliq_icms_destino / 100) - val_icms_proprio;
            return val_icms_st;
        }


        /// <summary>
        /// Retorna Base Calculo ICMS ST
        /// </summary>
        /// <param name="val_bc_icms"></param>
        /// <param name="val_ipi"></param>
        /// <param name="val_mva_ajustado"></param>
        /// <returns></returns>
        public static decimal BaseCalculoICMSST(decimal val_bc_icms, decimal val_ipi, decimal val_mva_ajustado)
        {
            decimal val_bc_icms_st = 0;
            val_bc_icms_st = (val_bc_icms + val_ipi) * ((100 + val_mva_ajustado) / 100);
            return val_bc_icms_st;
        }


        /// <summary>
        /// Retorna Valor Redução Base Calculo ICMS
        /// </summary>
        /// <param name="val_aliq_red_icms"></param>
        /// <param name="val_bc_icms"></param>
        /// <param name="val_aliq_icms"></param>
        /// <returns></returns>
        public static decimal RedBaseCalculoICMS(decimal val_aliq_red_icms, decimal val_bc_icms, decimal val_aliq_icms)
        {
            decimal val_red_icms_reduzida = 0;
            val_red_icms_reduzida = val_bc_icms * (1 - val_aliq_red_icms);
            return val_red_icms_reduzida;

        }


        /// <summary>
        /// Retorna Valor ICMS
        /// </summary>
        /// <param name="val_red_bc_icms"></param>
        /// <param name="val_aliq_icms"></param>
        /// <returns></returns>
        public static decimal CalculoICMS20(decimal val_red_bc_icms, decimal val_aliq_icms )
        {
            decimal val_icms = 0;

            val_icms = val_red_bc_icms * val_aliq_icms / 100;
            return val_icms;
        }


        /// <summary>
        /// Calcula o ICMS Proprio
        /// </summary>
        /// <param name="val_icms"></param>
        /// <param name="val_aliq_icms"></param>
        /// <returns></returns>
        public static decimal CalculoICMSProprio(decimal val_icms, decimal val_aliq_icms)
        {
            decimal val_icms_proprio = 0;
            val_icms_proprio = val_icms * val_aliq_icms / 100;
            return val_icms_proprio;
        }
 

        /// <summary>
        /// Retorna Valor ICMS ST
        /// </summary>
        /// <param name="val_bc_icms_st"></param>
        /// <param name="val_aliq_icms"></param>
        /// <param name="val_icms_proprio"></param>
        /// <returns></returns>
        public static decimal CalculoICMS30(decimal val_bc_icms_st, decimal val_aliq_icms, decimal val_icms_proprio)
        {
            decimal val_icms_st = 0;
            val_icms_st = (val_bc_icms_st * val_aliq_icms / 100) - val_icms_proprio;
            return val_icms_st;
        }

    }
}
